package cn.iocoder.yudao.module.member.dal.mysql.collectNotes;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.member.dal.dataobject.collectNotes.CollectNotesDO;
import cn.iocoder.yudao.module.member.dal.dataobject.newsStudyInfo.NewsStudyInfoDO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.member.controller.admin.collectNotes.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 收藏备注 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface CollectNotesMapper extends BaseMapperX<CollectNotesDO> {

    default PageResult<CollectNotesDO> selectPage(CollectNotesPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CollectNotesDO>()
                .eqIfPresent(CollectNotesDO::getUserId, reqVO.getUserId())
                .eqIfPresent(CollectNotesDO::getRelationId, reqVO.getRelationId())
                .eqIfPresent(CollectNotesDO::getRelationType, reqVO.getRelationType())
                .eqIfPresent(CollectNotesDO::getCollectStatus, reqVO.getCollectStatus())
                .eqIfPresent(CollectNotesDO::getRemarks, reqVO.getRemarks())
                .betweenIfPresent(CollectNotesDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(CollectNotesDO::getId));
    }

    default List<CollectNotesDO> selectList(CollectNotesExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<CollectNotesDO>()
                .eqIfPresent(CollectNotesDO::getUserId, reqVO.getUserId())
                .eqIfPresent(CollectNotesDO::getRelationId, reqVO.getRelationId())
                .eqIfPresent(CollectNotesDO::getRelationType, reqVO.getRelationType())
                .eqIfPresent(CollectNotesDO::getCollectStatus, reqVO.getCollectStatus())
                .eqIfPresent(CollectNotesDO::getRemarks, reqVO.getRemarks())
                .betweenIfPresent(CollectNotesDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(CollectNotesDO::getId));
    }
    List<CollectNotesRespVO> getCollectNotesPage(IPage page, @Param("params") Map<String, Object> params);

    void saveNotesRecord( @Param("record") CollectNotesDO record);

}
